#include "APP_Device.h"
#include "APP_Router.h"
#include "APP_BT.h"
#include "APP_Serial.h"

int main(int argc, char const *argv[])
{
    // char* file_name = "/home/su_da/gateway/test_file";
    // //初始化线程池
    // APP_Pool_Init();
    // //初始化mqtt
    // APP_MQTT_Init();
    // //初始化网关设备
    // Device* device = APP_Device_Init(file_name);
    // //启动读取数据线程任务
    // APP_Device_Start(device);
    // char str[] = {0x01,0x02,0x03,0x23,0x23,0x65,0x66,0x67,'\0'};
    // APP_Device_recv_router(device,str,8);

    // sleep(1000000);
    // return 0;

    char* file_name = "/home/su_da/gateway/test_file1";
    // int len = strlen("{\"conn_type\":1,\"id\":\"2323\",\"msg\":\"616263\"}");
    // log_info("len = %d",len);
    //初始化线程池
    APP_Pool_Init();
    //初始化mqtt
    APP_MQTT_Init();
    //初始化路由模块
    APP_Router_Init();
    //初始化网关设备
    Device* device = APP_Device_Init(file_name);
    //初始化串口设备
    APP_Serial_Init(device);
    //初始化蓝牙设备
    APP_BT_Init(device);//蓝牙设备的配置 需要借助串口来发送配置数据
    //网关设备注册到路由模块
    APP_Router_register_Device(device);

    sleep(10000);
    return 0;
}
